I have a list of about 1000 object identifiers. I want to run a script that searches for each one and returns how many were not found.
Module m = current
I guess I need to figure out how to best do this. I'd like to be able to take my list of numbers from Excel and just drop them into my code. Should I just create an array like "Array numbers = create(int 1, int 2, int 3 . . . int 1000)"? stevenson - Fri Jul 26 17:17:44 EDT 2013 |
Re: Go To Script I think you have a list of ObjIDs perhaps in Excel, and you want a DXL that reads the list and tells you which ones actually exist in a particular module and which do not.
Let me scribble an outline:
-Louie |
Re: Go To Script llandale - Sat Jul 27 16:23:20 EDT 2013 I think you have a list of ObjIDs perhaps in Excel, and you want a DXL that reads the list and tells you which ones actually exist in a particular module and which do not.
Let me scribble an outline:
-Louie
You'll have to excuse my novice-level experience, but I've yet to use Skip or Stream commands. They seem incredibly powerful and useful from what I've read and very much applicable to what I'm trying to accomplish. Anyway, I've been trying to just use the Stream command, but I keep receiving " badly formed token ("C:\Users\tesla\Desktop\list.txt"))". The file is just a text file with numbers listed in a vertical column. Do I need to save it in another format? I can concatenate my array in excel and use the following simplified script:
Module m = current Unfortunately I keep getting incorrect arguments for 'do' and syntax error at 'then count++'. Any ideas? |
Re: Go To Script stevenson - Mon Jul 29 11:26:00 EDT 2013
You'll have to excuse my novice-level experience, but I've yet to use Skip or Stream commands. They seem incredibly powerful and useful from what I've read and very much applicable to what I'm trying to accomplish. Anyway, I've been trying to just use the Stream command, but I keep receiving " badly formed token ("C:\Users\tesla\Desktop\list.txt"))". The file is just a text file with numbers listed in a vertical column. Do I need to save it in another format? I can concatenate my array in excel and use the following simplified script:
Module m = current Unfortunately I keep getting incorrect arguments for 'do' and syntax error at 'then count++'. Any ideas? C:\Users\tesla\Desktop\list.txt Its the back-slashes; a very common mistake. A backslash is the "escape" character and since there is no escape for "U" you get the error. Either convert them all to double slashes or better yet get in the habit of using frontslashes:
-Louie My notes say these are the ONLY valid escaped characters; the manual is wrong: \b t \n \v \f \r \\ |
Re: Go To Script llandale - Mon Jul 29 16:21:44 EDT 2013 C:\Users\tesla\Desktop\list.txt Its the back-slashes; a very common mistake. A backslash is the "escape" character and since there is no escape for "U" you get the error. Either convert them all to double slashes or better yet get in the habit of using frontslashes:
-Louie My notes say these are the ONLY valid escaped characters; the manual is wrong: \b t \n \v \f \r \\ I've tried to modify the script to the following:
Module m = current
while (true)
if (end inFile)
Skip skpObjs = create() // KEY 'string' ObjID; DATA: 'Object' handle
print "Results Found:\t\t" count "\n"
I'm not sure I'm accessing the Stream the correct way to read line by line, but the only errors that appear when I try to run the script are at 'then count++' (line 25), which is a syntax error and line 32, which is not even a line in the code (only 30 lines) but also appears as a syntax error. |
Re: Go To Script stevenson - Mon Jul 29 18:32:59 EDT 2013 I've tried to modify the script to the following:
Module m = current
while (true)
if (end inFile)
Skip skpObjs = create() // KEY 'string' ObjID; DATA: 'Object' handle
print "Results Found:\t\t" count "\n"
I'm not sure I'm accessing the Stream the correct way to read line by line, but the only errors that appear when I try to run the script are at 'then count++' (line 25), which is a syntax error and line 32, which is not even a line in the code (only 30 lines) but also appears as a syntax error. Here you go...
Module m = current
Object o = null
string ID = ""
int count = 0
int count2 = 0
Skip skpObjs = createString // KEY 'string' ObjID; DATA: 'Object' handle
Skip skpIDs = createString // KEY and DATA both 'string' "ID" read from the file
Stream inFile = read("U:/list.txt")
// read identifiers from text file into a skip list
while (!end inFile)
{
inFile >> ID
put(skpIDs, ID, ID)
}
close(inFile)
// read object identifiers into a skip list
for o in m do
{
put(skpObjs, identifier(o), identifier(o))
}
// for each identifier in the first skip list, see if it exists in the second
for ID in skpIDs do
{
if (find(skpObjs, ID, o))
{
// identifier exists in doors
count++
}
else
{
// identifier does not exist in doors
count2++
}
}
print "Results Found:\t\t" count "\n"
print "Results Not Found:\t\t" count2 "\n"
|
Re: Go To Script Tony_Goodman - Tue Jul 30 03:44:25 EDT 2013 Here you go...
Module m = current
Object o = null
string ID = ""
int count = 0
int count2 = 0
Skip skpObjs = createString // KEY 'string' ObjID; DATA: 'Object' handle
Skip skpIDs = createString // KEY and DATA both 'string' "ID" read from the file
Stream inFile = read("U:/list.txt")
// read identifiers from text file into a skip list
while (!end inFile)
{
inFile >> ID
put(skpIDs, ID, ID)
}
close(inFile)
// read object identifiers into a skip list
for o in m do
{
put(skpObjs, identifier(o), identifier(o))
}
// for each identifier in the first skip list, see if it exists in the second
for ID in skpIDs do
{
if (find(skpObjs, ID, o))
{
// identifier exists in doors
count++
}
else
{
// identifier does not exist in doors
count2++
}
}
print "Results Found:\t\t" count "\n"
print "Results Not Found:\t\t" count2 "\n"
Thank you both very much! |